function MyStorage(){};
MyStorage.prototype = {
    constructor: MyStorage,
    set(key, value){
        if(typeof value === "object"){
            localStorage.setItem(key,JSON.stringify(value));
        }
        else{
            localStorage.setItem(key,value);
        }
    },
    get(key){
        return localStorage.getItem(key);
    },
    jget(key){;
        return JSON.parse(localStorage.getItem(key));
    },
    match(key_pre){
        let str = '^'+key_pre+'.*';
        let reg = new RegExp(str);
        let keyObj = [];
        for(let i=0;i<localStorage.length;i++){
            if(reg.test(localStorage.key(i))){
                let key = localStorage.key(i);
                let value = localStorage.getItem(key);
                let obj = {key:key,value:value};
                keyObj.push(obj);
            }
        }
        return keyObj;
    },
    remove(key){
        localStorage.removeItem(key);
    },
    removeMatch(key_pre){
        let str = '^'+key_pre+'.*';
        let reg = new RegExp(str);
        let keyName = [];
        for(let i=0;i<localStorage.length;i++){
            if(reg.test(localStorage.key(i))){
                keyName.push(localStorage.key(i));
            }
        }
        for(let j=0;j<keyName.length;j++){
            localStorage.removeItem(keyName[j]);
        }
    }
}